﻿using AppFlat.Domain.IRespostroy;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AppFlat.Domain.Respostory
{
    public class UnitOfWork:IUnitOfWork
    {
        public DbContext Db
        {
            get
            {
                return DbContextFactory.Create();
            }
        }

        public bool SaveChanges()
        {
            return Db.SaveChanges() > 0;
        }

        public async Task<bool> SaveChangesAsync()
        {
            return await Db.SaveChangesAsync()>0;
        }
    }
}
